package com.dullfox.sbm.common.bean;

/**
 * Author: zengdy
 * Date: 2018/10/25
 */
public class Result {
    private int code = 200;
    private String msg;
    private Object data;

    public Result(){}

    public Result(int code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public static Result success() {
       return Result.success(null);
    }

    public static Result success(Object data) {
        Result result =  new Result();
        if(null!=data) {
            result.data = data;
        }
        return result;
    }

    public static Result fail() {
        return Result.fail(null);
    }

    public static Result fail(String msg) {
        return new Result(500,msg);
    }
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
